﻿using Fur;
using Fur.DatabaseAccessor;
using Microsoft.Extensions.DependencyInjection;

namespace FurTemplate.EntityFramework.Core
{
    [AppStartup(600)]
    public sealed class FurTemplateEntityFrameworkCoreStartup : AppStartup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDatabaseAccessor(options =>
            {
#if (MsSql)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.SqlServer);
#elif (MySql)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.MySql);
#elif (Oracle)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Oracle);
#elif (PgSql)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.PgSql);
#elif (SQLite)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Sqlite);
#elif (Cosmos)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Cosmos);
#elif (Firebird)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Firebird);
#elif (Dm)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Dm);
#elif (InMemory)
                options.AddDbPool<FurTemplateDbContext>(DbProvider.InMemoryDatabase);
#else
                options.AddDbPool<FurTemplateDbContext>(DbProvider.Sqlite);
#endif
            }, "FurTemplate.Database.Migrations");
        }
    }
}